{% extends "base.html" %}
{% block account %}
<!-- Login/Register -->
	{% if user.is_authenticated %}
		<div class = "login" ><a href="#">Welcome: {{user.username}}</a>/<a href="/accounts/logout/">Logout</a></div>
	{% else %}
		<div class = "login" ><a href="/accounts/login/" id = "login-tag">Login</a>/<a href="/register/">Register</a></div>
	{% endif %}
{% endblock %}

{% block content %}
	<span class = "servererror">
	{% if form.errors %}
	<h5>Sorry, incorrect username or password !</h5>
	{% endif %}
	</span>
	
	<form id = "loginform" action="/accounts/login/" method="post">{% csrf_token %}
	<fieldset>
	<legend>User details</legend>
	<ul>
	<li>
	
	<label for="username">Username: </label><input class = "text required" type="text" name="username" value="" id="username"/>
	</li>
	<li>
	<label  for="password">Password: </label><input  class = "text required" minlength="4" maxlength="20" type="password" name="password" value="" id="password"/>
	</li>
	
	<li>
	<input class="button" type="submit" value="login" />
	</li>
	</ul>
	</fieldset>
	<div class="clear"></div>
	</form>
	<!-- Login/Register -->

  <script>
  $(document).ready(function(){
    $("#loginform").validate();
  });
  </script>
  
{% endblock %}
